package space.sakana.edusysback.mapper.job;

import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
import space.sakana.edusysback.entity.job.JobItem;
import space.sakana.edusysback.entity.job.JobPushItem;

import java.util.List;

@Mapper
public interface JobItemMapper {

    @Select("select `id`, `jid`, `pid`, `uid`, `finish`, `score` from jobitem where `id`=#{id};")
    JobItem selectJobItemById(int id);

    @Select("select `id`, `jid`, `pid`, `uid`, `finish`, `score` from jobitem where `jid`=#{jid};")
    List<JobItem> selectJobItemsByJid(int jid);

    @Insert("insert into jobitem(`jid`, `pid`, `uid`) values(#{jid}, #{pid}, #{uid});")
    int insertJobItem(JobItem jobItem);

    @Update("update jobitem set `jid`=#{jid}, `pid`=#{pid}, `uid`=#{uid}, `finish`=#{finish}, `score`=#{score} where `id`=#{id};")
    int updateJobItem(JobItem jobItem);

}
